//----------------------------------------------------------------------------------
// CPlayer class
// Author: Enric Vergara
//
// Description:
// Clase Player del juego arkanoid
//----------------------------------------------------------------------------------
#pragma once
#ifndef INC_PLAYER_H_
#define INC_PLAYER_H_

#include <string>

//---Engine Includes----

//-----------------------

typedef enum ePlayerMovingState
{
    PLAYER_MOVING_RIGHT,
    PLAYER_MOVING_LEFT,
    PLAYER_STOPPED
} PLAYER_MOVING_STATES;

//--Forward Declaration--
class CSpriteEpic;
class CGameRenderer;
class CInput;
class CLevel;
//-----------------------

class CPlayer
{
public:
	CPlayer(CSpriteEpic * l_pSpriteBody, CSpriteEpic * l_pSpriteLeft, CSpriteEpic * l_pSpriteRight,
		CInput * l_pInput, CGameRenderer * l_pGameRenderer) :                   
                                                                m_eState(PLAYER_STOPPED),
                                                                m_SpriteBody(l_pSpriteBody),
																m_SpriteLeft(l_pSpriteLeft),
																m_SpriteRight(l_pSpriteRight),
                                                                m_pInput(l_pInput),
                                                                m_sName("Player"),
                                                                m_uBallsLeft(0),
                                                                m_iScore(0),
                                                                m_fElapsedTime(0.f),
																m_bPaused(false),
																m_fTimeStoped(0)
                                                                {};

	virtual ~CPlayer(void) {};

	void					CreatePlayer		(Vect2f & v_lPos);
	void					Update				(float deltaTime, CLevel * l_pLevel);
	void					Paused				(bool l_bPaused);

	//----Set functions----
    void                    SetState            (PLAYER_MOVING_STATES l_eState) {m_eState = l_eState;};
	void					SetName				(const std::string& name)		{m_sName = name;};
	void					SetScore			(int32 score)					{m_iScore = score;};
	void					SetInput			(CInput* input)					{m_pInput = input;};
	void					SetBallsLeft		(uint16 ballsLeft)				{m_uBallsLeft = ballsLeft;};
	void					SetSpriteBody		(CSpriteEpic* sprite)			{m_SpriteBody = sprite;};
	void					SetSpriteLeft		(CSpriteEpic* sprite)			{m_SpriteLeft = sprite;};
	void					SetSpriteRight		(CSpriteEpic* sprite)			{m_SpriteRight = sprite;};
	void                    SetPosition			(Vect2f & v_lPos);	
	void                    Scale				(Vect2f l_fScale);

	//----Get functions----
    PLAYER_MOVING_STATES    GetState            ()								{return m_eState;};
	const std::string&		GetName				()								{return m_sName;};
	int32					GetScore			()								{return m_iScore;};
	CInput*					GetInput			()								{return m_pInput;};
	uint16					GetBallsLeft		()								{return m_uBallsLeft;};
	CSpriteEpic*			GetSpriteBody		()								{return m_SpriteBody;};
	CSpriteEpic*			GetSpriteLeft		()								{return m_SpriteLeft;};
	CSpriteEpic*			GetSpriteRight		()								{return m_SpriteRight;};
	bool					isPaused			()						  const { return m_bPaused; };

private:
    CPlayer() {};

	//Sprites que forman el Player:
	CSpriteEpic*			m_SpriteBody;
	CSpriteEpic*			m_SpriteLeft;
	CSpriteEpic*			m_SpriteRight;
    
	PLAYER_MOVING_STATES    m_eState;
	CInput*					m_pInput;
	std::string				m_sName;
	uint16					m_uBallsLeft;
	int32					m_iScore;
    float               	m_fElapsedTime;
	float					m_fTimeStoped;
	bool					m_bPaused;
};

#endif //INC_PLAYER_H_